#include "gtest/gtest.h"

#include "predictors/predictor_target.h"
#include "predictors/predictor_const_v.h"
#include "predictors/predictor_link.h"
#include "arenas/arena_1dfood.h"
#include "machine.h"
#include "machine_factory.h"
#include "model.h"
#include "model_link.h"

TEST(Model, Model)
{
  Predictor_base *p = new Predictor_target("TEST");

  Model *m1 = new Model(p);
  Model *m2 = new Model(p);

  m1->set_string_id("Model 1");

  ASSERT_FALSE( m1->is_active() );
  ASSERT_FALSE( m2->is_active() );

  m1->add_inhibitor_link( m2 );

  m2->activate( 10.0 );
  ASSERT_TRUE( m2->is_active() );

  m2->activate_output_link();
  ASSERT_TRUE( m2->get_output_link()->is_active() );

  m1->activate( 10.0 );
  ASSERT_TRUE( m1->is_active() );

  // the output link of m1 must now be inactive since m2 is inhibitor
  m1->activate_output_link();
  ASSERT_FALSE( m1->get_output_link()->is_active() );
}
